export default class food extends Laya.Script {
    // 更多参数说明请访问: https://ldc2.layabox.com/doc/?nav=zh-as-2-4-0
    owner=this.owner as Laya.Sprite;
    sign=" "
    
    constructor() { super(); }
    
    onAwake(){
        
        
    }

    Init(sign){
        this.sign=sign;
    }
    onTriggerEnter(other){
        if(other.label=="player"){
        this.owner.removeSelf();
        Laya.Pool.recover(this.sign,this.owner); 
        }
    }
    onUpdate(){
    
        this.owner.getComponent(Laya.RigidBody).linearVelocity={x:-20,y:0}
        if(this.owner.x<-110){
            this.owner.removeSelf();
        Laya.Pool.recover(this.sign,this.owner);             
        }

    }
}